package cn.calm.fileManager.entity;

public class FileUploadStatus {
	private String fileName;
	private Long fileSize;
	private Long currentSize;

	public String getFileName() {
		return fileName;
	}

	public void setFileName(String fileName) {
		this.fileName = fileName;
	}

	public Long getFileSize() {
		return fileSize;
	}

	public void setFileSize(Long fileSize) {
		this.fileSize = fileSize;
	}

	public Long getCurrentSize() {
		return currentSize;
	}

	public void setCurrentSize(Long currentSize) {
		this.currentSize = currentSize;
	}

	public Double getPercent() {
		if (fileSize == 0) {
			return Double.valueOf(0);
		} else {
			return Math.floor(Double.longBitsToDouble(currentSize) / Double.longBitsToDouble(fileSize)*100);
		}
	}

	@Override
	public String toString() {
		return "FileUploadStatus [fileName=" + fileName + ", fileSize="
				+ fileSize + ", currentSize=" + currentSize + ", getPercent()="
				+ getPercent() + "]";
	}
}
